<?php

/**
 * This is the model class for table "jumlahhaji".
 *
 * The followings are the available columns in table 'jumlahhaji':
 * @property integer $jh_id
 * @property integer $jh_kec
 * @property integer $jh_daftar
 * @property integer $jh_batal
 * @property integer $jh_berangkat
 * @property integer $jh_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $jhKec
 */
class Jumlahhaji extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Jumlahhaji the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'jumlahhaji';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('jh_kec, jh_daftar, jh_batal, jh_berangkat, jh_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('jh_id, jh_kec, jh_daftar, jh_batal, jh_berangkat, jh_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'jhKec' => array(self::BELONGS_TO, 'Kecamatan', 'jh_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'jh_id' => 'Jh',
			'jh_kec' => 'Kecamatan',
			'jh_daftar' => 'Daftar',
			'jh_batal' => 'Batal',
			'jh_berangkat' => 'Berangkat',
			'jh_tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('jh_id',$this->jh_id);
		$criteria->compare('jh_kec',$this->jh_kec);
		$criteria->compare('jh_daftar',$this->jh_daftar);
		$criteria->compare('jh_batal',$this->jh_batal);
		$criteria->compare('jh_berangkat',$this->jh_berangkat);
		$criteria->compare('jh_tahun',$this->jh_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}